home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / GETFDAT0.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  50 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * given a valid filename, returns modification date and time
  15.  * formatted as a string:  dd-mmm-yy hh:mm
  16.  *
  17.  *)
  18.  
  19. function get_file_date (filename:      anystring): anystring;
  20. const
  21.    month : array [1..12] of string[3]
  22.            = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  23.               'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
  24. var
  25.    DirInfo:     SearchRec;
  26.    Stamp:       DateTime;
  27.  
  28.    function strval (i: integer): string;
  29.    begin
  30.       strval := chr(((i div 10) mod 10) + ord('0')) +
  31.                 chr((i mod 10) + ord('0'));
  32.    end;
  33.  
  34. begin
  35.    FindFirst(filename,$21,DirInfo);
  36.    if (DosError <> 0) then
  37.       get_file_date := 'No such file'
  38.    else
  39.  
  40.    begin
  41.       UnpackTime(DirInfo.time, Stamp);
  42.       get_file_date := strval(Stamp.Day) + '-' +
  43.                        month[Stamp.Month] + '-' +
  44.                        strval(Stamp.Year) + ' ' +
  45.                        strval(Stamp.Hour) + ':' +
  46.                        strval(Stamp.Min);
  47.    end;
  48. end;
  49.  
  50.